const Koa = require('koa');
const app = new Koa();

var koa_static = require('koa-static');
var router = require('./route');


app.use(koa_static(__dirname + '/static'));

// logger
app.use(async (ctx, next) => {
  const start = new Date();
  await next();
  const ms = new Date() - start;
  console.log(`${ctx.method} ${ctx.url} - ${ms}ms`);
});

// route
app.use(router.routes(), router.allowedMethods())

app.listen(3000);
console.log('Koa Server is Started!');
